#ifndef _TASK_SCHEDULER_H
#define _TASK_SCHEDULER_H

#include "timeslice.h"
#include "semaphore.h"

typedef void (*task_handler_t)(void);
typedef TimesilceTaskObj TaskObj;

enum 
{
  TASK_SCHEDULER_INIT_READY = 1,
  TASK_SCHEDULER_NOT_READY,
};

/* function declare */
unsigned int ApplyForTask_ID(void);
u8 get_task_scheduler_isReady(void);

void init_task_scheduler(void);
void TaskSchedulerStartRun(void);
void task_object_init(TaskObj *obj, 
                     task_handler_t handler, 
                     unsigned int id,
                     const char *p_name, 
                     unsigned int time_interval);
                     
void task_create(TaskObj *obj, 
                 task_handler_t handler, 
                 unsigned int id,
                 const char *p_name, 
                 unsigned int time_interval);
                 
void task_add(TaskObj* obj);
void task_delete(TaskObj* obj);
unsigned int task_time_interval(TaskObj* obj);
unsigned int task_total_nums(void);
void print_all_tasks_name(void);
unsigned char task_isExist(TaskObj* obj);
unsigned int task_id(TaskObj* obj);
char *task_name(TaskObj* obj);
unsigned char task_status(TaskObj* obj);
unsigned int task_timer_left(TaskObj* obj);


#endif
